home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / WBUTTON.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  5.2 KB  |  152 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WButton -- Base class for the Windows 95 button controls.
  14.  *
  15.  *
  16.  *   Events:
  17.  *
  18.  *       Click --
  19.  *
  20.  *       DoubleClick --
  21.  *
  22.  *************************************************************************/
  23.  
  24. #ifndef _WBUTTON_HPP_INCLUDED
  25. #define _WBUTTON_HPP_INCLUDED
  26. #pragma once
  27.  
  28. #ifndef _WNO_PRAGMA_PUSH
  29. #pragma pack(push,8);
  30. #pragma enum int;
  31. #endif
  32.  
  33. #ifndef _WCONTROL_HPP_INCLUDED
  34. #  include "wcontrol.hpp"
  35. #endif
  36.  
  37. #include "wevent.hpp"
  38.  
  39. enum WButtonStateValues {
  40.     WBStateNotChecked = 0x00000000,
  41.     WBStateNotSet = WBStateNotChecked,
  42.  
  43.     WBStateChecked = 0x00000001,
  44.     WBStateSet = WBStateChecked,
  45.  
  46.     WBStateIndeterminate = 0x00000002,
  47.     WBStatePushed = 0x00000004, /* BST_PUSHED  */
  48.     WBStateFocus = 0x00000008 /*  BST_FOCUS */
  49.     
  50. };
  51. typedef WULong WButtonState;
  52.  
  53.  
  54. //
  55. // Button styles
  56. //
  57.  
  58. #define WBSDefault              ((WStyle)0x50000000L)  // WS_VISIBLE|WS_CHILD
  59. #define WBSRightButton          ((WStyle)0x00000020L)  // BS_RIGHTBUTTON
  60. #define WBSIcon                 ((WStyle)0x00000040L)  // BS_ICON
  61. #define WBSBitmap               ((WStyle)0x00000080L)  // BS_BITMAP
  62. #define WBSLeft                 ((WStyle)0x00000100L)  // BS_LEFT
  63. #define WBSRight                ((WStyle)0x00000200L)  // BS_RIGHT
  64. #define WBSCenter               ((WStyle)0x00000300L)  // BS_CENTER
  65. #define WBSTop                  ((WStyle)0x00000400L)  // BS_TOP
  66. #define WBSBottom               ((WStyle)0x00000800L)  // BS_BOTTOM
  67. #define WBSVCenter              ((WStyle)0x00000C00L)  // BS_VCENTER
  68. #define WBSPushLike             ((WStyle)0x00001000L)  // BS_PUSHLIKE
  69. #define WBSMultiline            ((WStyle)0x00002000L)  // BS_MULTILINE
  70. #define WBSNotify               ((WStyle)0x00004000L)  // BS_NOTIFY
  71. #define WBSFlat                 ((WStyle)0x00008000L)  // BS_FLAT
  72.  
  73. // Types of button
  74. // Note: These style are mutually exclusive
  75.  
  76. #define WBSPushButton           ((WStyle)0x00000000L)  // BS_PUSHBUTTON
  77. #define WBSDefPushButton        ((WStyle)0x00000001L)  // BS_DEFPUSHBUTTON
  78. #define WBSCheckBox             ((WStyle)0x00000002L)  // BS_CHECKBOX
  79. #define WBSAutoCheckBox         ((WStyle)0x00000003L)  // BS_AUTOCHECKBOX
  80. #define WBSRadioButton          ((WStyle)0x00000004L)  // BS_RADIOBUTTON
  81. #define WBSThreeState           ((WStyle)0x00000005L)  // BS_3STATE
  82. #define WBS3State               ((WStyle)0x00000005L)  // BS_3STATE
  83. #define WBSAutoThreeState       ((WStyle)0x00000006L)  // BS_AUTO3STATE
  84. #define WBSAuto3State           ((WStyle)0x00000006L)  // BS_AUTO3STATE
  85. #define WBSAutoRadioButton      ((WStyle)0x00000009L)  // BS_AUTORADIOBUTTON
  86. #define WBSOwnerDraw            ((WStyle)0x0000000BL)  // BS_OWNERDRAW
  87. #define WBSGroupBox             ((WStyle)0x00000007L)  // BS_GROUPBOX
  88.  
  89. class WCMCLASS WButton : public WControl {
  90.     WDeclareSubclass( WButton, WControl )
  91.  
  92.     public:
  93.  
  94.         /**********************************************************
  95.          * Constructors and destructors
  96.          *********************************************************/
  97.  
  98.         WButton();
  99.  
  100.         ~WButton();
  101.  
  102.         /**************************************************************
  103.          * Properties
  104.          **************************************************************/
  105.  
  106.         // AutoSize
  107.  
  108.         virtual WBool SetAutoSize( WBool on );
  109.         virtual WBool GetAutoSize() const;
  110.  
  111.         /**************************************************************
  112.          * Methods
  113.          **************************************************************/
  114.  
  115.         // AutoSize
  116.         //
  117.         //      Invoked when autosizing needs to be done
  118.  
  119.         virtual WBool AutoSize();
  120.     
  121.         /**************************************************************
  122.          * Overrides
  123.          **************************************************************/
  124.  
  125.         virtual const WChar * InitializeClass();
  126.  
  127.         virtual WStyle GetDefaultStyle() const;
  128.  
  129.         virtual WBool ProcessCommand( WUInt id, WNotify code,
  130.                                       WNotifyInfo info, WLong & returns );
  131.     
  132.         virtual WBool SetText( const WString & text );
  133.  
  134.         virtual WBool SetFont( const WFont & font, WBool preserveSize=TRUE );
  135.  
  136.         virtual WBool WantsDragMessage( WULong whichButton ) const;
  137.  
  138.         /**************************************************************
  139.          * Data members
  140.          **************************************************************/
  141.  
  142.     private:
  143.         WBool       _autoSize;
  144. };
  145.  
  146. #ifndef _WNO_PRAGMA_PUSH
  147. #pragma enum pop;
  148. #pragma pack(pop);
  149. #endif
  150.  
  151. #endif // _WBUTTON_HPP_INCLUDED
  152.